﻿#include "includes\\InputStructures.fx"
#include "includes\\CommonResources.fx"
#include "includes\\StateDefinitions.fx"

float4x4 xSkySphereTranslationMatrix;
float4x4 xSkySphereRotationMatrix;
float4x4 xSkySphereScalingMatrix;
texture2D xSkyTexture;
float4 xSkyColor;


struct PsInput_Sky
{
	float4 ScreenPos : SV_POSITION;
	float2 UV: TEXCOORD;
};


PsInput_Sky SkyVS(VsInput_PTN input)
{
	PsInput_Sky output = (PsInput_Sky)0;
	
	float4x4 wvpMatrix = mul(xSkySphereScalingMatrix, xSkySphereRotationMatrix);
	wvpMatrix = mul(wvpMatrix, xSkySphereTranslationMatrix);
	wvpMatrix = mul(wvpMatrix, xViewProjectionMatrix);
	output.ScreenPos = mul(input.Pos, wvpMatrix);
	output.UV = input.UV;
	
	return output;
}


float4 SkyPS(PsInput_Sky input) : SV_Target
{
	float alpha = xSkyTexture.Sample(PlanarSampler, input.UV).r;

	return float4(xSkyColor.rgb, alpha);
}



